package com.jimmy.study.ehcache.young;

import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;

@Component
public class CacheMethod {
	// @Cacheable(value = "abc",key="personId")
	@Cacheable(value = "abc", key = "'CacheMethod-print-id-'+#id")
	public String getYoung(String id) {
		System.err.println("getYoung method is running...");
		return "getYoung : arg : " + id;
	}

	@CacheEvict(value = { "abc" }, allEntries = true)
	public void clearYoung() {
		System.err.println("clearYoung 清空緩存");
	}
}
